Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deduplicate localization code #14

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Deduplicate localization code #14

wants to merge 3 commits into from

Conversation

hanrodz
Copy link
Member

@hanrodz hanrodz commented Nov 1, 2024

Description

Deduplicate code in getLocalizedElement and getLocalizedString by extracting logic into getLocalizedStringOrElement which returns an object containing fields string and element which are read by the separate methods.

Test Plan

Change defaultLanguage to en and npm run dev for each step and validate console error and warning:

  • Remove en definition for one localized element.
  • Previous step and remove es definition for the same localized element.
  • Previous step and remove element definition for the same localized element.
  • Previous step and remove identifier definition for the same localized element.

@hanrodz hanrodz self-assigned this Nov 1, 2024
@hanrodz hanrodz linked an issue Nov 1, 2024 that may be closed by this pull request
@hanrodz
Copy link
Member Author

hanrodz commented Nov 1, 2024

@sofiadparamo the code works but i'd appreciate your thoughts on this implementation as i'm relatively new to typescript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deduplicate code to fetch localized strings and elements
1 participant